\subsection{Cauchy sequences}
In \( \mathbb R, \mathbb C \), every Cauchy sequence is convergent.
We wish to generalise this notion to an arbitrary metric space.
Recall that a sequence \( (x_n) \) in \( \mathbb R \) or \( \mathbb C \) is bounded if there exists \( c \in \mathbb R^+ \) such that \( \forall n \in \mathbb N, \abs{x_n} \leq c \).
\begin{definition}
	A sequence \( (x_n) \) in a metric space \( M \) is said to be \textit{Cauchy} if
	\[
		\forall \varepsilon > 0, \exists N \in \mathbb N, \forall m,n \geq N, d(x_m,x_n) < \varepsilon
	\]
	The sequence is bounded if
	\[
		\exists z \in M, \exists r > 0, \forall n \in \mathbb N, x_n \in \mathcal B_r(z)
	\]
	This is equivalent to
	\[
		\forall z \in M, \exists r > 0, \forall n \in \mathbb N, x_n \in \mathcal B_r(z)
	\]
	by considering the triangle inequality around the given \( z \) point.
	In particular, if the metric arises from a norm, \( (x_n) \) is bounded if and only if \( \norm{x_n} \) is bounded.
\end{definition}
\begin{lemma}
	If a sequence is convergent, it is Cauchy.
	If a sequence is Cauchy, it is bounded.
\end{lemma}
\begin{proof}
	Let \( (x_n) \) be a sequence in \( M \).
	First, we assume that \( (x_n) \) is convergent in \( M \), so let \( x \) be the limit.
	Given \( \varepsilon > 0 \), there exists \( N \in \mathbb N \) such that \( \forall n \geq N \), \( d(x_n, x) < \varepsilon \).
	Then, for all \( m, n \geq N \), we have \( d(x_m, x_n) \leq d(x_m, x) + d(x, x_n) \leq 2\varepsilon \) as required.
	So \( (x_n) \) is Cauchy.

	Now conversely, we assume \( (x_n) \) is Cauchy.
	There exists \( n \in \mathbb N \) such that \( \forall m, n \geq N \), we have \( d(x_m, x_n) < 1 \).
	In particular, \( d(x_n, x_N) < 1 \) for \( n \geq N \).
	In other words, \( x_n \in \mathcal B_1(x_N) \).
	Now, let \( r = \max\qty{d(x_1, x_N), \dots, d(x_{N-1}, x_N), 1} \).
	This \( r \) is a bound for all elements of the sequence; for all \( n \in \mathbb N, x_n \in \mathcal B_r(x_N) \).
\end{proof}
\begin{remark}
	Boundedness does not imply the sequence is Cauchy.
	For instance, consider the sequence \( 0,1,0,1,\dots \) in \( \mathbb R \).
	If a sequence is Cauchy, it is not necessarily convergent in an arbitrary metric space (not \( \mathbb R, \mathbb C \)).
	For instance, consider \( x_n = \frac{1}{n} \) in \( (0, \infty) \).
	This is certainly not convergent, since the limit cannot be zero.
\end{remark}

\subsection{Definition of completeness}
\begin{definition}
	A metric space \( M \) is called \textit{complete} if every Cauchy sequence in \( M \) converges in \( M \).
\end{definition}
\begin{example}
	\( \mathbb R, \mathbb C \) are complete.
\end{example}

\subsection{Completeness of product spaces}
\begin{proposition}
	Product spaces of complete spaces are complete.
	More precisely, if \( M, M' \) are complete, then so is \( M \oplus_p M' \).
\end{proposition}
\begin{proof}
	Let \( (a_n) \) be a Cauchy sequence in the product space \( M \oplus_p M' \).
	We will write \( a_n = (x_n, x_n') \) for all \( n \).
	Then, since \( (a_n) \) is Cauchy,
	\[
		\forall \varepsilon > 0, \exists N \in \mathbb N, \forall m,n \in N, d_p(a_m, a_n) < \varepsilon
	\]
	Then, for all \( m, n \geq N \),
	\[
		d(x_m,x_n) \leq \max\qty{d(x_m,x_n), d(x_m', x_n')} \leq d_p(a_m,a_n) < \varepsilon
	\]
	Hence \( (x_n) \) is Cauchy in \( M \), and similarly \( (x_m') \) is Cauchy in \( M' \).
	Since \( M, M' \) are complete, \( (x_n), (x_n') \) are convergent in \( M, M' \) to \( x, x' \).
	Now, let \( a = (x,x') \).
	Then,
	\[
		d_p(a_n,a) \leq d_1(a_n,a) = d(x_n,x) + d(x_n',x') \to 0
	\]
	So the product space is complete.
\end{proof}
\begin{remark}
	\( (a_n) \) is Cauchy in \( M \oplus_p M' \) if and only if \( (x_n) \) is Cauchy in \( M \) and \( (x_n') \) is Cauchy in \( M' \).
\end{remark}
\begin{corollary}
	\( \mathbb R^n, \mathbb C^n \) are complete in the \( \ell_p \) metric.
	In particular, \( n \)-dimensional real or complex Euclidean space is complete.
\end{corollary}

\subsection{Completeness of subspaces and function spaces}
\begin{theorem}
	Let \( S \) be any set.
	Then, \( \ell_\infty(S) \), the set of bounded scalar functions on \( S \), is complete in the uniform metric \( D \).
\end{theorem}
\begin{proof}
	Let \( (f_n) \) be a Cauchy sequence in \( \ell_\infty(S) \).
	Then,
	\[
		\forall \varepsilon > 0, \exists N \in \mathbb N, \forall m,n \geq N, D(x_m, x_n) = \sup_{x \in S} \abs{f_m(x) - f_n(x)} < \varepsilon
	\]
	In other words, \( \forall m,n \geq N, \forall x \in S, \abs{f_m(x) - f_n(x)} < \varepsilon \).
	So \( (f_n) \) is uniformly Cauchy as defined previously.
	As shown previously, \( (f_n) \) is uniformly convergent.
	Hence, there is a scalar function \( f \) on \( S \) such that \( f_n \to f \) uniformly on \( S \).
	We have also shown previously that the uniform limit \( f \) of bounded functions \( (f_n) \) is bounded.
	In other words, \( f \in \ell_\infty(S) \).
	Now it remains to show that \( f_n \to f \) in the uniform metric.
	\[
		\forall \varepsilon > 0, \exists N \in \mathbb N, \forall n \geq M, \forall x \in S, \abs{f_n(x) - f(x)} < \varepsilon
	\]
	Hence,
	\[
		\forall n \geq N, \sup_{x \in S} \abs{f_n(x) - f(x)} = D(f_n,f) \leq \varepsilon
	\]
	which is convergence in the metric as required.
\end{proof}
\begin{proposition}
	Let \( N \) be a subspace of a metric space \( M \).
	Then,
	\begin{enumerate}
		\item If \( N \) is complete, \( N \) is closed in \( M \).
		\item If \( M \) is complete and \( N \) is closed in \( M \), then \( N \) is complete.
	\end{enumerate}
	In other words, in a complete metric space, a subspace is complete if and only if it is closed.
\end{proposition}
\begin{proof}
	To prove (i), we let \( (x_n) \) be a sequence in \( N \) and assume that \( x_n \to x \) in \( M \).
	We want to show that \( x \in N \).
	We know \( (x_n) \) is convergent in \( M \), so it is Cauchy in \( M \).
	So \( (x_n) \) is Cauchy in \( N \).
	Since \( N \) is complete, \( x_n \to y \) in \( N \).
	So \( x_n \to y \) in \( M \).
	By uniqueness of limits, \( x = y \) as required.

	Now we want to prove (ii) is complete.
	Let \( (x_n) \) be a Cauchy sequence in \( N \).
	Then \( (x_n) \) is Cauchy in \( M \).
	Since \( M \) is complete, \( x_n \to x \) in \( M \) for some \( x \in M \).
	Since \( N \) is closed in \( M \), \( x \in N \).
	So \( x_n \to x \) in \( N \).
\end{proof}
\begin{theorem}
	Let \( (M, d) \) be a metric space, and define \( C_b(M) \) to be the set of functions \( f \) in \( \ell_\infty(M) \) such that \( f \) is continuous.
	This is a subspace of \( \ell_\infty(M) \) in the uniform metric \( D \).
	\( C_b(M) \) is complete in the uniform metric.
\end{theorem}
\begin{proof}
	By the above proposition, it is sufficient to show that \( C_b(M) \) is closed in \( \ell_\infty(M) \).
	Let \( (f_n) \) be a sequence in \( C_b(M) \) and we assume that \( f_n \to f \) in \( \ell_\infty(M) \).
	We want to show that \( f_n \in C_b(M) \).
	It is now sufficient to show that \( f \) is continuous, or equivalently, continuous at every point in \( M \).
	Let \( a \in M \), and let \( \varepsilon > 0 \).
	Since \( f_n \to f \) in \( \ell_\infty(M) \), we can fix \( n \in \mathbb N \) such that \( F(f_n,f) < \varepsilon \).
	Since \( f_n \) is continuous (at \( a \)),
	\[
		\exists \delta > 0, \forall x \in M, d(x,a) < \delta \implies \abs{f_n(x) - f_n(a)} < \varepsilon
	\]
	Hence, \( \forall x \in M \), if \( d(x,a) < \delta \) we have
	\begin{align*}
		\abs{f(x) - f(a)} &\leq \abs{f(x) - f_n(x)} + \abs{f_n(x) - f_n(a)} + \abs{f_n(a) - f(a)} \\
		&\leq 2 D(f_n,f) + \abs{f_n(x) - f_n(a)} \\
		&< 3\varepsilon
	\end{align*}
\end{proof}
\begin{corollary}
	Consider \( C[a,b] \), the space of continuous functions on \( [a,b] \).
	This space is complete in the uniform metric, since \( C[a,b] = C_b[a,b] \).
\end{corollary}
\begin{definition}
	Let \( S \) be a set, and \( (N,e) \) be a metric space.
	Then we generalise \( \ell_\infty(S) \) to the following definition.
	\[
		\ell_\infty(S,N) = \qty{f \colon S \to N \colon f \text{ is bounded}}
	\]
	where \( f \) is bounded if there exists \( y \in N, r > 0 \) such that \( \forall x \in S, f(x) \in \mathcal B_r(y) \).
	If \( g \colon S \to N \) is a bounded function, \( \forall x \in S, g(x) \in \mathcal B_s(z) \), then
	\[
		\forall x \in S, e(f(x),g(x)) \leq e(f(x),y) + e(y,z) + e(z,g(x)) \leq r + e(y,z) + s
	\]
	This is a uniform bound for all \( x \), so we may take the supremum.
	So \( \sup_{x \in S} e(f(x), g(x)) \) exists and we denote this by
	\[
		\mathcal D(f,g) = \sup_{x \in S} e(f(x), g(x))
	\]
	This can be shown to be a metric, called the uniform metric on \( \ell_\infty(S,N) \).
	Now, let \( S = M \), where \( (M,d) \) is a metric space.
	We define
	\[
		C_b(M, N) = \qty{f \colon M \to N \colon f \text{ continuous and bounded}}
	\]
	Note that \( C_b(M,N) \) is a subspace of \( \ell_\infty(M,N) \) with the uniform metric.
\end{definition}
\begin{theorem}
	Let \( S \) be a set, let \( (M,d) \) be a metric space, and let \( (N,e) \) be a complete metric space.
	Then
	\begin{enumerate}
		\item \( \ell_\infty(S,N) \) is complete in the uniform metric \( D \);
		\item \( C_b(M,N) \) is complete in the uniform metric \( D \).
	\end{enumerate}
\end{theorem}
\begin{proof}
	We first prove part (i).
	Let \( (f_n) \) be a Cauchy sequence in \( \ell_\infty(S, N) \).
	We first show that \( (f_n) \) is pointwise Cauchy.
	Let \( x \in S \).
	\[
		\forall \varepsilon > 0, \exists K \in \mathbb N, \forall i,j \geq K, D(f_i, f_j) < \varepsilon
	\]
	In particular, \( e(f_i(x), f_j(x)) \leq D(f_i,f_j) < \varepsilon \) for \( i,j \geq K \).
	So the sequence \( (f_k(x))_k \) is Cauchy in \( N \).
	Since \( N \) is complete, \( (f_k(x))_k \) converges.
	This holds for all \( x \in S \), hence we can define \( f \colon S \to N \) by \( f(x) = \lim_{k \to \infty} f_k(x) \).

	Now, we must show that \( f \) is bounded, such that \( f \in \ell_\infty(S,N) \).
	Since \( f_k \) is Cauchy in the uniform metric \( D \), there exists \( K \in \mathbb N \) such that \( \forall i,j \geq K \), \( D(f_i,f_j) < 1 \).
	In particular, for all \( i \geq K \), \( D(f_i,f_K) < 1 \).
	Since \( f_K \) is bounded, there exists \( y \in N, r > 0 \) such that \( \forall x \in S, f_K(x) \in \mathcal B_r(y) \).
	Then, by the triangle inequality, for a fixed \( x \in S \), \( \forall i \geq K, e(f_i(x), f_K(x)) \leq D(f_i(x), f_K(x)) < 1 \).
	Let \( i \to \infty \), then \( e(f_i(x), f_K(x)) \leq 1 \).
	Hence \( e(f(x),y) \leq e(f(x), f_K(x)) + e(f_K(x),y) \leq 1 + r \).
	But since this is true for all \( x \), \( 1 + r \) is a uniform bound; \( \forall x \in S, f(x) \in \mathcal B_{r+1}(y) \).

	Now we will show that \( f_k \to f \) uniformly in \( D \).
	Again, we use
	\[
		\forall \varepsilon > 0, \exists K \in \mathbb N, \forall i,j \geq K, D(f_i, f_j) < \varepsilon
	\]
	So choose \( i \geq K \), and \( x \in S \).
	Then for all \( j \geq K \), \( e(f_i(x), f_j(x)) \leq D(f_i, f_j) < \varepsilon \).
	As \( j \to \infty \), \( e(f(x), f_i(x)) \leq \varepsilon \), because metrics are continuous.
	But since \( x \) was arbitrary, we have a uniform distance \( D(f, f_i) < \varepsilon \).
	This holds for all \( i \geq K \), so we have uniform convergence.

	Now we prove part (ii).
	By part (i) and an above proposition, it is enough to show that \( C_b(M,N) \) is closed in \( \ell_\infty(M,N) \).
	Let \( (f_k) \) be a sequence in \( C_b(M,N) \) and \( f_k \to f \) in \( \ell_\infty(M,N) \).
	We require \( f \in C_b(M,N) \), so it is enough to show that \( f \) is continuous.
	This is exactly the proof that the uniform limit of continuous functions is continuous.
	Let \( a \in M \), \( \varepsilon > 0 \).
	Then, since \( f_k \to f \) in \( \ell_\infty(M,N) \), we can fix \( k \in \mathbb N \) such that \( D(f_k,f) < \varepsilon \).
	Since \( f_k \) is continuous, \( \exists \delta > 0, \forall x \in M, d(x,a) < \delta \implies e(f_k(x), f_k(a)) < \varepsilon \).
	\begin{align*}
		\forall x \in M, f(x,a) < \delta \implies e(f(x),f(a)) &\leq e(f(x), f_k(x)) + e(f_k(x), f_k(a)) + e(f_k(a), f(a)) \\
		&\leq 3\varepsilon
	\end{align*}
\end{proof}
